import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { UnlockService } from '../../../services/native/authentication/authentication.service';

@IonicPage()
@Component({
    selector: 'page-fingerprint-login',
    templateUrl: 'fingerprint-login.html',
})
export class FingerprintLoginPage {

    constructor(private unlockService: UnlockService) {
    }

    ionViewDidLoad() {
    }

    ionViewDidEnter() {
        this.unlockService.validateFingerprint().then(result => {
            // 验证通过，展示内容页面
            if (result) {
                this.unlockService.goToContentPage();
            }
        })
    }

    showFingerprintNative() {
        // const isApp = document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1;
        // if (!isApp) {
        //     this.unlockService.goToContentPage();
        //     return;
        // }

        this.unlockService.validateFingerprint().then(result => {
            // 验证通过，展示内容页面
            if (result) {
                this.unlockService.goToContentPage();
            }
        })
    }

    goToBasicLogin() {
        this.unlockService.goToBasicLoginPage();
    }
}
